<template>
  <div class="home">
    <h1>奖品列表大傻瓜哈哈哈哈哈哈哈哈哈哈哈</h1>
    <ul>
      <li
        v-for="(item, idx) in prize_data"
        :key="idx"
        @click="chat(item.diagram, item.name)"
      >
        {{ item.name }}
      </li>
    </ul>
  </div>
</template>

<style lang="scss">
* {
  box-sizing: border-box;
  list-style: none;
  padding: 0;
  margin: 0;
}
.home {
  margin: 20px auto;
  padding-top: 10px;
  width: 300px;
  height: 500px;
  background: rgba(255, 0, 0, 0.3);
  box-shadow: 5px 5px 5px #cecdcd;
  border: 1px solid yellow;
  overflow: visible;
  h1 {
    letter-spacing: 1em;
    font-weight: normal;
    text-align: center;
    color: yellow;
  }
  ul {
    width: 100%;
    height: 90%;
    //background-color: yellow;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    li {
      cursor: pointer;
      font-weight: 300;
      height: 30px;
      line-height: 30px;
      letter-spacing: 3px;
      color: white;
      &:nth-child(2n) {
        background: rgba(255, 0, 0, 0.3);
      }
      &:nth-child(2n-1) {
        background: rgba(255, 0, 0, 0.2);
      }
    }
  }
}
</style>
<script>
export default {
  name: "Home",
  data() {
    return {
      prize_data: null,
    };
  },

  async created() {
    let res = await this.$axios(
      "http://wheel.couchpotato.fun/index/wheel/get_prize_list"
    );

    this.prize_data = res.data.data.prize_list;
  },
  components: {},
  methods: {
    chat(diagram, na) {
      this.$router.push({
        name: `List`,
        params: { nameId: diagram, name: na },
      });
    },
  },
};
</script>
